<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>救援员管理系统登录</title>
<link href="css/login.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jQuery1.7.js"></script>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/jquery1.42.min.js"></script>
<script type="text/javascript" src="js/jquery.SuperSlide.js"></script>
<script type="text/javascript" src="js/Validform_v5.3.2_min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
	var $tab_li = $('#tab ul li');
	$tab_li.hover(function(){
		$(this).addClass('selected').siblings().removeClass('selected');
		var index = $tab_li.index(this);
		$('div.tab_box > div').eq(index).show().siblings().hide();
	});	
});
</script>

<script type="text/javascript">
$(function(){
/*用户登录信息验证*/
$("#stu_username_hide").focus(function(){
 var username = $(this).val();
 if(username=='输入账号'){
 $(this).val('');
 }
});
$("#stu_username_hide").focusout(function(){
 var username = $(this).val();
 if(username==''){
 $(this).val('输入账号');
 }
});

$("#stu_email_hide").focus(function(){
	 var username = $(this).val();
	 if(username=='输入邮箱'){
	 $(this).val('');
	 }
	});
	$("#stu_email_hide").focusout(function(){
	 var username = $(this).val();
	 if(username==''){
	 $(this).val('输入邮箱');
	 }
	});

$("#stu_password_hide").focus(function(){
 var username = $(this).val();
 if(username=='输入密码'){
 $(this).val('');
 }
});
$("#stu_password_hide").focusout(function(){
 var username = $(this).val();
 if(username==''){
 $(this).val('输入密码');
 }
});

$(".stu_login_error").Validform({
	tiptype:function(msg,o,cssctl){
		var objtip=$(".stu_error_box");
		cssctl(objtip,o.type);
		objtip.text(msg);
		ajaxPost:true
	},
	
});
/* 管理员登录信息验证*/
$("#tea_username_hide").focus(function(){
 var username = $(this).val();
 if(username=='输入账号'){
 $(this).val('');
 }
});
$("#tea_username_hide").focusout(function(){
 var username = $(this).val();
 if(username==''){
 $(this).val('输入账号');
 }
});
$("#tea_password_hide").focus(function(){
 var username = $(this).val();
 if(username=='输入密码'){
 $(this).val('');
 }
});
$("#tea_password_hide").focusout(function(){
 var username = $(this).val();
 if(username==''){
 $(this).val('输入密码');
 }
});
$("#tea_code_hide").focus(function(){
 var username = $(this).val();
 if(username=='输入验证码'){
 $(this).val('');
 }
});
$("#tea_code_hide").focusout(function(){
 var username = $(this).val();
 if(username==''){
 $(this).val('输入验证码');
 }
});
$(".tea_login_error").Validform({
	tiptype:function(msg,o,cssctl){
		var objtip=$(".tea_error_box");
		cssctl(objtip,o.type);
		objtip.text(msg);
		ajaxPost:true
	},
	
});
});
</script>

<script type="text/javascript">
$(function(){
	$(".screenbg ul li").each(function(){
		$(this).css("opacity","0");
	});
	$(".screenbg ul li:first").css("opacity","1");
	var index = 0;
	var t;
	var li = $(".screenbg ul li");	
	var number = li.size();
	function change(index){
		li.css("visibility","visible");
		li.eq(index).siblings().animate({opacity:0},3000);
		li.eq(index).animate({opacity:1},3000);
	}
	function show(){
		index = index + 1;
		if(index<=number-1){
			change(index);
		}else{
			index = 0;
			change(index);
		}
	}
	t = setInterval(show,3000);
	//根据窗口宽度生成图片宽度
	var width = $(window).width();
	$(".screenbg ul img").css("width",width+"px");
});
</script>

<script type="text/javascript">
function validateemail()
{
         var accemail = document.getElementById("accemail");    //获取email控件对象
         if (!accemail.value == "") {
                   var reg =/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;

                   var bool = reg.test(accemail.value);
                   if (bool == false) {
                           alert("邮箱格式错误，请重新输入！");
                           accemail.focus();
                           return;
                   }
         }    
}

</script>
<body>
	<%
out.println("本次访问时间："+new java.util.Date().toLocaleString()+"<br>");
//获取客户端的所有cookie对象
Cookie[] cookies=request.getCookies();
Cookie cookie_response=null;
for (int i=0;cookies!=null&&i<cookies.length;i++){
		cookie_response=cookies[i];
}
if(cookie_response!=null){
	//输出上一次访问的时间
	out.println("上一次访问时间："+ cookie_response.getValue());}
	else{
	//创建cookie
	cookie_response=new Cookie("AccessTime","");}
	//设置cookie_response对象为最新时间
	cookie_response.setValue(new java.util.Date().toLocaleString());
	response.addCookie(cookie_response);
%>
	<div id="tab">
		<ul class="tab_menu">
			<li class="selected">用户登录</li>
			<li>管理员登录</li>
			<li>游客浏览</li>
		</ul>
		<div class="tab_box">
			<!-- 用户登录开始 -->
			<div>
				<div class="stu_error_box"></div>
				<!--form action="LoginServlet" method="post"  class="stu_login_error" >  -->
				<form action="LoginServlet"
					class="stu_login_error" method="post">

					<div id="username">
						<label>账&nbsp;&nbsp;&nbsp;号：</label> <input type="text"
							id="idnumber" name="idnumber" placeholder="输入身份证号"
							nullmsg="账号不能为空！" datatype="s6-18" errormsg="账号范围在6~18个字符之间！"
							sucmsg="账号验证通过！" />
					</div>
					<div id="password">
						<label>密&nbsp;&nbsp;&nbsp;码：</label> <input type="password"
							id="userpwd" name="userpwd" placeholder="输入密码" nullmsg="密码不能为空！"
							datatype="*6-16" errormsg="密码范围在6~16位之间！" sucmsg="密码验证通过！" />
					</div>
					<div id="remember">
						<input type="checkbox" name="remember"> <label>记住密码</label>
					</div>
					<div id="login">
						<button type="submit">登录</button>
					</div>
				</form>
				<div id="login">
					<a href="http://localhost:8080/Rescue/Register.jsp">
						<button>注册</button>
					</a>
				</div>
			</div>

			<!-- 用户登录结束-->

			<!-- 管理登录开始-->
			<div class="hide">
				<div class="tea_error_box"></div>
				<form action="LoginServlet"
					class="tea_login_error" method="post">
					<div id="username">
						<label>管理号：</label> <input type="text" id="tea_username_hide"
							name="idnumber" placeholder="输入管理号" nullmsg="管理号不能为空！"
							datatype="s6-18" errormsg="管理号范围在6~18个字符之间！" sucmsg="教工号验证通过！" />

					</div>
					<div id="password">
						<label>密&nbsp;&nbsp;&nbsp;码：</label> <input type="password"
							id="tea_password_hide" name="password" placeholder="输入密码"
							nullmsg="密码不能为空！" datatype="*6-16" errormsg="密码范围在6~16位之间！"
							sucmsg="密码验证通过！" />
					</div>
					<div id="remember">
						<input type="checkbox" name="remember"> <label>记住密码</label>
					</div>
					<div id="login">
						<button type="submit">登录</button>
					</div>
				</form>
			</div>
			<!-- 游客浏览 开始-->
			<div class="hide">
				<div class="tea_error_box"></div>
				<div id="login">
					<button type="submit">返回首页</button>
				</div>
			</div>
			<!-- 游客浏览结束 -->
		</div>
	</div>
	<div class="bottom">
		<a href="Women&Heaven.jsp">©2019 救援员管理系统</a>
	</div>
	<div class="screenbg">
		<ul>
			<li><a href="javascript:;"><img src="images/rescue6.jpg"></a></li>
			<li><a href="javascript:;"><img src="images/rescue5.jpg"></a></li>
			<li><a href="javascript:;"><img src="images/rescue2.jpg"></a></li>
		</ul>
	</div>
</body>
</html>